package com.warm.pump.module.monitor.dao.gen;

import java.util.List;
import java.util.Map;
import java.util.Date;
import java.math.BigDecimal;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import com.warm.pump.frame.gen.bean.PageBean;
import com.warm.pump.frame.gen.util.TypeCast;
import com.warm.pump.frame.gen.exception.ServiceException;
import com.warm.pump.module.monitor.bean.po.gen.MonitorDefine;
import com.warm.pump.module.monitor.mapper.gen.MonitorDefineMapper;
import com.warm.pump.module.monitor.bean.po.gen.MonitorDefineExample;

@Repository
public class MonitorDefineDao {
    // 日志对象
    private transient Log log = LogFactory.getLog(this.getClass());
    @Autowired
    private MonitorDefineMapper monitorDefineMapper;

    // 增加一个后台MonitorDefine表

    public boolean insert(MonitorDefine monitorDefine) {
        try {
            monitorDefineMapper.insert(monitorDefine);
            log.debug("后台MonitorDefine表增加成功");
            return true;
        } catch (Exception e) {
            log.debug("后台MonitorDefine表增加失败");
            throw new ServiceException("后台MonitorDefine表增加失败", e);
        }
    }
    // 增加一个后台MonitorDefine表Selective

    public boolean insertSelective(MonitorDefine monitorDefine) {
        try {
            monitorDefineMapper.insertSelective(monitorDefine);
            log.debug("后台MonitorDefine表增加成功");
            return true;
        } catch (Exception e) {
            log.debug("后台MonitorDefine表增加失败");
            throw new ServiceException("后台MonitorDefine表增加失败", e);
        }
    }

    // 删除一个后台MonitorDefine表

    public boolean deleteByPrimaryKey(Long id) {
        try {
            monitorDefineMapper.deleteByPrimaryKey(id);
            log.debug("后台MonitorDefine表删除成功");
            return true;
        } catch (Exception e) {
            log.debug("后台MonitorDefine表删除失败");
            throw new ServiceException("后台MonitorDefine表删除失败", e);
        }
    }
    // 删除一个后台MonitorDefine表byMap

    public boolean deleteByMap(Map monitorDefineMap) {
        try {
            monitorDefineMapper.deleteByExample(createMonitorDefineExample(monitorDefineMap, null, null));
            log.debug("后台MonitorDefine根据Map删除成功");
            return true;
        } catch (Exception e) {
            log.debug("后台MonitorDefine根据GroupID删除失败");
            throw new ServiceException("后台MonitorDefine根据object删除失败", e);
        }
    }
    // 修改一个后台MonitorDefine表

    public boolean updateByPrimaryKey(MonitorDefine monitorDefine) {
        try {
            monitorDefineMapper.updateByPrimaryKey(monitorDefine);
            log.debug("后台MonitorDefine表修改成功");
            return true;
        } catch (Exception e) {
            log.debug("后台MonitorDefine表修改失败");
            throw new ServiceException("后台MonitorDefine表修改失败", e);
        }
    }
    // 修改一个后台MonitorDefine表Selective

    public boolean updateByPrimaryKeySelective(MonitorDefine monitorDefine) {
        try {
            monitorDefineMapper.updateByPrimaryKeySelective(monitorDefine);
            log.debug("后台MonitorDefine表修改成功");
            return true;
        } catch (Exception e) {
            log.debug("后台MonitorDefine表修改失败");
            throw new ServiceException("后台MonitorDefine表修改失败", e);
        }
    }
    // 修改一个后台MonitorDefine表

    public boolean updateByMap(MonitorDefine monitorDefine, Map monitorDefineMap) {
        try {
            monitorDefineMapper.updateByExample(monitorDefine, createMonitorDefineExample(monitorDefineMap, null, null));
            log.debug("后台批量MonitorDefine表修改成功");
            return true;
        } catch (Exception e) {
            log.debug("后台批量MonitorDefine表修改失败");
            throw new ServiceException("后台MonitorDefine表批量修改失败", e);
        }
    }
    // 修改一个后台MonitorDefine表Selective

    public boolean updateByMapSelective(MonitorDefine monitorDefine, Map monitorDefineMap) {
        try {
            monitorDefineMapper.updateByExampleSelective(monitorDefine, createMonitorDefineExample(monitorDefineMap, null, null));
            log.debug("后台批量MonitorDefine表修改成功");
            return true;
        } catch (Exception e) {
            log.debug("后台批量MonitorDefine表修改失败");
            throw new ServiceException("后台MonitorDefine表批量修改失败", e);
        }
    }

    // 查询一个后台MonitorDefine表

    public MonitorDefine selectByPrimaryKey(Long id) {
        return monitorDefineMapper.selectByPrimaryKey(id);
    }

    // 查询一个后台MonitorDefine表-根据map

    public MonitorDefine selectByMap(Map monitorDefineMap) {
        List<MonitorDefine> list = getListByMap(monitorDefineMap);
        if (list == null || list.isEmpty()) {
            return null;
        } else {
            return list.get(0);
        }
    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////////
    // 查询所有后台MonitorDefine表

    public List<MonitorDefine> getListByMap(Map monitorDefineMap) {

        return monitorDefineMapper.selectByExample(createMonitorDefineExample(monitorDefineMap, null, null));
    }

    //统计后台MonitorDefine表数量

    public int countTotalByMap(Map monitorDefineMap) {

        return monitorDefineMapper.countByExample(createMonitorDefineExample(monitorDefineMap, null, null));
    }


    public List<MonitorDefine> getListByMapPage(Map monitorDefineMap, int limitStart,
                                                int limitOffset) {

        return monitorDefineMapper.selectByExample(createMonitorDefineExample(monitorDefineMap, limitStart, limitOffset));
    }


    public PageBean getPageBeanByMap(Map monitorDefineMap, int pageNo, int pageSize) {
        Integer count = countTotalByMap(monitorDefineMap);
        PageBean pageBean = new PageBean();
        pageBean.setCount(count);
        pageBean.setPageNo(pageNo);
        pageBean.setPageSize(pageSize);
        int limitStart = pageBean.getStartNo();
        int limitOffset = pageSize;
        pageBean.setData(monitorDefineMapper.selectByExample(createMonitorDefineExample(monitorDefineMap, limitStart, limitOffset)));
        return pageBean;
    }

    private MonitorDefineExample createMonitorDefineExample(Map monitorDefineMap, Integer limitStart, Integer limitOffset) {
        MonitorDefineExample monitorDefineEx = new MonitorDefineExample();
        MonitorDefineExample.Criteria c = monitorDefineEx.createCriteria();
        Long id_null = TypeCast.getLong(monitorDefineMap.get("id_null"));
        Long id_notNull = TypeCast.getLong(monitorDefineMap.get("id_notNull"));
        Long id = TypeCast.getLong(monitorDefineMap.get("id"));
        Long id_not = TypeCast.getLong(monitorDefineMap.get("id_not"));
        Long id_greater = TypeCast.getLong(monitorDefineMap.get("id_greater"));
        Long id_greaterEqual = TypeCast.getLong(monitorDefineMap.get("id_greaterEqual"));
        Long id_less = TypeCast.getLong(monitorDefineMap.get("id_less"));
        Long id_lessEqual = TypeCast.getLong(monitorDefineMap.get("id_lessEqual"));
        List<Long> id_in = TypeCast.getLongList(monitorDefineMap.get("id_in"));
        List<Long> id_notIn = TypeCast.getLongList(monitorDefineMap.get("id_notIn"));
        Long id_between1 = TypeCast.getLong(monitorDefineMap.get("id_between1"));
        Long id_between2 = TypeCast.getLong(monitorDefineMap.get("id_between2"));
        Long id_notBetween1 = TypeCast.getLong(monitorDefineMap.get("id_notBetween1"));
        Long id_notBetween2 = TypeCast.getLong(monitorDefineMap.get("id_notBetween2"));

        if (id_null != null) {
            c.andIdIsNull();
        }
        if (id_notNull != null) {
            c.andIdIsNotNull();
        }
        if (id != null) {
            c.andIdEqualTo(id);
        }
        if (id_not != null) {
            c.andIdNotEqualTo(id_not);
        }
        if (id_greater != null) {
            c.andIdGreaterThan(id_greater);
        }
        if (id_greaterEqual != null) {
            c.andIdGreaterThanOrEqualTo(id_greaterEqual);
        }
        if (id_less != null) {
            c.andIdLessThan(id_less);
        }
        if (id_lessEqual != null) {
            c.andIdLessThanOrEqualTo(id_lessEqual);
        }
        if (id_in != null) {
            c.andIdIn(id_in);
        }
        if (id_notIn != null) {
            c.andIdNotIn(id_notIn);
        }
        if (id_between1 != null) {
            c.andIdBetween(id_between1, id_between2);
        }
        if (id_notBetween1 != null) {
            c.andIdNotBetween(id_notBetween1, id_notBetween2);
        }
        String code_null = TypeCast.getString(monitorDefineMap.get("code_null"));
        String code_notNull = TypeCast.getString(monitorDefineMap.get("code_notNull"));
        String code = TypeCast.getString(monitorDefineMap.get("code"));
        String code_not = TypeCast.getString(monitorDefineMap.get("code_not"));
        String code_greater = TypeCast.getString(monitorDefineMap.get("code_greater"));
        String code_greaterEqual = TypeCast.getString(monitorDefineMap.get("code_greaterEqual"));
        String code_less = TypeCast.getString(monitorDefineMap.get("code_less"));
        String code_lessEqual = TypeCast.getString(monitorDefineMap.get("code_lessEqual"));
        String code_like = TypeCast.getString(monitorDefineMap.get("code_like"));
        String code_notLike = TypeCast.getString(monitorDefineMap.get("code_notLike"));
        List<String> code_in = TypeCast.getStringList(monitorDefineMap.get("code_in"));
        List<String> code_notIn = TypeCast.getStringList(monitorDefineMap.get("code_notIn"));
        String code_between1 = TypeCast.getString(monitorDefineMap.get("code_between1"));
        String code_between2 = TypeCast.getString(monitorDefineMap.get("code_between2"));
        String code_notBetween1 = TypeCast.getString(monitorDefineMap.get("code_notBetween1"));
        String code_notBetween2 = TypeCast.getString(monitorDefineMap.get("code_notBetween2"));

        if (code_null != null) {
            c.andCodeIsNull();
        }
        if (code_notNull != null) {
            c.andCodeIsNotNull();
        }
        if (code != null) {
            c.andCodeEqualTo(code);
        }
        if (code_not != null) {
            c.andCodeNotEqualTo(code_not);
        }
        if (code_greater != null) {
            c.andCodeGreaterThan(code_greater);
        }
        if (code_greaterEqual != null) {
            c.andCodeGreaterThanOrEqualTo(code_greaterEqual);
        }
        if (code_less != null) {
            c.andCodeLessThan(code_less);
        }
        if (code_lessEqual != null) {
            c.andCodeLessThanOrEqualTo(code_lessEqual);
        }
        if (code_like != null) {
            c.andCodeLike(code_like);
        }
        if (code_notLike != null) {
            c.andCodeNotLike(code_notLike);
        }
        if (code_in != null) {
            c.andCodeIn(code_in);
        }
        if (code_notIn != null) {
            c.andCodeNotIn(code_notIn);
        }
        if (code_between1 != null) {
            c.andCodeBetween(code_between1, code_between2);
        }
        if (code_notBetween1 != null) {
            c.andCodeNotBetween(code_notBetween1, code_notBetween2);
        }
        String name_null = TypeCast.getString(monitorDefineMap.get("name_null"));
        String name_notNull = TypeCast.getString(monitorDefineMap.get("name_notNull"));
        String name = TypeCast.getString(monitorDefineMap.get("name"));
        String name_not = TypeCast.getString(monitorDefineMap.get("name_not"));
        String name_greater = TypeCast.getString(monitorDefineMap.get("name_greater"));
        String name_greaterEqual = TypeCast.getString(monitorDefineMap.get("name_greaterEqual"));
        String name_less = TypeCast.getString(monitorDefineMap.get("name_less"));
        String name_lessEqual = TypeCast.getString(monitorDefineMap.get("name_lessEqual"));
        String name_like = TypeCast.getString(monitorDefineMap.get("name_like"));
        String name_notLike = TypeCast.getString(monitorDefineMap.get("name_notLike"));
        List<String> name_in = TypeCast.getStringList(monitorDefineMap.get("name_in"));
        List<String> name_notIn = TypeCast.getStringList(monitorDefineMap.get("name_notIn"));
        String name_between1 = TypeCast.getString(monitorDefineMap.get("name_between1"));
        String name_between2 = TypeCast.getString(monitorDefineMap.get("name_between2"));
        String name_notBetween1 = TypeCast.getString(monitorDefineMap.get("name_notBetween1"));
        String name_notBetween2 = TypeCast.getString(monitorDefineMap.get("name_notBetween2"));

        if (name_null != null) {
            c.andNameIsNull();
        }
        if (name_notNull != null) {
            c.andNameIsNotNull();
        }
        if (name != null) {
            c.andNameEqualTo(name);
        }
        if (name_not != null) {
            c.andNameNotEqualTo(name_not);
        }
        if (name_greater != null) {
            c.andNameGreaterThan(name_greater);
        }
        if (name_greaterEqual != null) {
            c.andNameGreaterThanOrEqualTo(name_greaterEqual);
        }
        if (name_less != null) {
            c.andNameLessThan(name_less);
        }
        if (name_lessEqual != null) {
            c.andNameLessThanOrEqualTo(name_lessEqual);
        }
        if (name_like != null) {
            c.andNameLike(name_like);
        }
        if (name_notLike != null) {
            c.andNameNotLike(name_notLike);
        }
        if (name_in != null) {
            c.andNameIn(name_in);
        }
        if (name_notIn != null) {
            c.andNameNotIn(name_notIn);
        }
        if (name_between1 != null) {
            c.andNameBetween(name_between1, name_between2);
        }
        if (name_notBetween1 != null) {
            c.andNameNotBetween(name_notBetween1, name_notBetween2);
        }
        String type_null = TypeCast.getString(monitorDefineMap.get("type_null"));
        String type_notNull = TypeCast.getString(monitorDefineMap.get("type_notNull"));
        String type = TypeCast.getString(monitorDefineMap.get("type"));
        String type_not = TypeCast.getString(monitorDefineMap.get("type_not"));
        String type_greater = TypeCast.getString(monitorDefineMap.get("type_greater"));
        String type_greaterEqual = TypeCast.getString(monitorDefineMap.get("type_greaterEqual"));
        String type_less = TypeCast.getString(monitorDefineMap.get("type_less"));
        String type_lessEqual = TypeCast.getString(monitorDefineMap.get("type_lessEqual"));
        String type_like = TypeCast.getString(monitorDefineMap.get("type_like"));
        String type_notLike = TypeCast.getString(monitorDefineMap.get("type_notLike"));
        List<String> type_in = TypeCast.getStringList(monitorDefineMap.get("type_in"));
        List<String> type_notIn = TypeCast.getStringList(monitorDefineMap.get("type_notIn"));
        String type_between1 = TypeCast.getString(monitorDefineMap.get("type_between1"));
        String type_between2 = TypeCast.getString(monitorDefineMap.get("type_between2"));
        String type_notBetween1 = TypeCast.getString(monitorDefineMap.get("type_notBetween1"));
        String type_notBetween2 = TypeCast.getString(monitorDefineMap.get("type_notBetween2"));

        if (type_null != null) {
            c.andTypeIsNull();
        }
        if (type_notNull != null) {
            c.andTypeIsNotNull();
        }
        if (type != null) {
            c.andTypeEqualTo(type);
        }
        if (type_not != null) {
            c.andTypeNotEqualTo(type_not);
        }
        if (type_greater != null) {
            c.andTypeGreaterThan(type_greater);
        }
        if (type_greaterEqual != null) {
            c.andTypeGreaterThanOrEqualTo(type_greaterEqual);
        }
        if (type_less != null) {
            c.andTypeLessThan(type_less);
        }
        if (type_lessEqual != null) {
            c.andTypeLessThanOrEqualTo(type_lessEqual);
        }
        if (type_like != null) {
            c.andTypeLike(type_like);
        }
        if (type_notLike != null) {
            c.andTypeNotLike(type_notLike);
        }
        if (type_in != null) {
            c.andTypeIn(type_in);
        }
        if (type_notIn != null) {
            c.andTypeNotIn(type_notIn);
        }
        if (type_between1 != null) {
            c.andTypeBetween(type_between1, type_between2);
        }
        if (type_notBetween1 != null) {
            c.andTypeNotBetween(type_notBetween1, type_notBetween2);
        }
        String misfireInformIds_null = TypeCast.getString(monitorDefineMap.get("misfireInformIds_null"));
        String misfireInformIds_notNull = TypeCast.getString(monitorDefineMap.get("misfireInformIds_notNull"));
        String misfireInformIds = TypeCast.getString(monitorDefineMap.get("misfireInformIds"));
        String misfireInformIds_not = TypeCast.getString(monitorDefineMap.get("misfireInformIds_not"));
        String misfireInformIds_greater = TypeCast.getString(monitorDefineMap.get("misfireInformIds_greater"));
        String misfireInformIds_greaterEqual = TypeCast.getString(monitorDefineMap.get("misfireInformIds_greaterEqual"));
        String misfireInformIds_less = TypeCast.getString(monitorDefineMap.get("misfireInformIds_less"));
        String misfireInformIds_lessEqual = TypeCast.getString(monitorDefineMap.get("misfireInformIds_lessEqual"));
        String misfireInformIds_like = TypeCast.getString(monitorDefineMap.get("misfireInformIds_like"));
        String misfireInformIds_notLike = TypeCast.getString(monitorDefineMap.get("misfireInformIds_notLike"));
        List<String> misfireInformIds_in = TypeCast.getStringList(monitorDefineMap.get("misfireInformIds_in"));
        List<String> misfireInformIds_notIn = TypeCast.getStringList(monitorDefineMap.get("misfireInformIds_notIn"));
        String misfireInformIds_between1 = TypeCast.getString(monitorDefineMap.get("misfireInformIds_between1"));
        String misfireInformIds_between2 = TypeCast.getString(monitorDefineMap.get("misfireInformIds_between2"));
        String misfireInformIds_notBetween1 = TypeCast.getString(monitorDefineMap.get("misfireInformIds_notBetween1"));
        String misfireInformIds_notBetween2 = TypeCast.getString(monitorDefineMap.get("misfireInformIds_notBetween2"));

        if (misfireInformIds_null != null) {
            c.andMisfireInformIdsIsNull();
        }
        if (misfireInformIds_notNull != null) {
            c.andMisfireInformIdsIsNotNull();
        }
        if (misfireInformIds != null) {
            c.andMisfireInformIdsEqualTo(misfireInformIds);
        }
        if (misfireInformIds_not != null) {
            c.andMisfireInformIdsNotEqualTo(misfireInformIds_not);
        }
        if (misfireInformIds_greater != null) {
            c.andMisfireInformIdsGreaterThan(misfireInformIds_greater);
        }
        if (misfireInformIds_greaterEqual != null) {
            c.andMisfireInformIdsGreaterThanOrEqualTo(misfireInformIds_greaterEqual);
        }
        if (misfireInformIds_less != null) {
            c.andMisfireInformIdsLessThan(misfireInformIds_less);
        }
        if (misfireInformIds_lessEqual != null) {
            c.andMisfireInformIdsLessThanOrEqualTo(misfireInformIds_lessEqual);
        }
        if (misfireInformIds_like != null) {
            c.andMisfireInformIdsLike(misfireInformIds_like);
        }
        if (misfireInformIds_notLike != null) {
            c.andMisfireInformIdsNotLike(misfireInformIds_notLike);
        }
        if (misfireInformIds_in != null) {
            c.andMisfireInformIdsIn(misfireInformIds_in);
        }
        if (misfireInformIds_notIn != null) {
            c.andMisfireInformIdsNotIn(misfireInformIds_notIn);
        }
        if (misfireInformIds_between1 != null) {
            c.andMisfireInformIdsBetween(misfireInformIds_between1, misfireInformIds_between2);
        }
        if (misfireInformIds_notBetween1 != null) {
            c.andMisfireInformIdsNotBetween(misfireInformIds_notBetween1, misfireInformIds_notBetween2);
        }
        String emailSubject_null = TypeCast.getString(monitorDefineMap.get("emailSubject_null"));
        String emailSubject_notNull = TypeCast.getString(monitorDefineMap.get("emailSubject_notNull"));
        String emailSubject = TypeCast.getString(monitorDefineMap.get("emailSubject"));
        String emailSubject_not = TypeCast.getString(monitorDefineMap.get("emailSubject_not"));
        String emailSubject_greater = TypeCast.getString(monitorDefineMap.get("emailSubject_greater"));
        String emailSubject_greaterEqual = TypeCast.getString(monitorDefineMap.get("emailSubject_greaterEqual"));
        String emailSubject_less = TypeCast.getString(monitorDefineMap.get("emailSubject_less"));
        String emailSubject_lessEqual = TypeCast.getString(monitorDefineMap.get("emailSubject_lessEqual"));
        String emailSubject_like = TypeCast.getString(monitorDefineMap.get("emailSubject_like"));
        String emailSubject_notLike = TypeCast.getString(monitorDefineMap.get("emailSubject_notLike"));
        List<String> emailSubject_in = TypeCast.getStringList(monitorDefineMap.get("emailSubject_in"));
        List<String> emailSubject_notIn = TypeCast.getStringList(monitorDefineMap.get("emailSubject_notIn"));
        String emailSubject_between1 = TypeCast.getString(monitorDefineMap.get("emailSubject_between1"));
        String emailSubject_between2 = TypeCast.getString(monitorDefineMap.get("emailSubject_between2"));
        String emailSubject_notBetween1 = TypeCast.getString(monitorDefineMap.get("emailSubject_notBetween1"));
        String emailSubject_notBetween2 = TypeCast.getString(monitorDefineMap.get("emailSubject_notBetween2"));

        if (emailSubject_null != null) {
            c.andEmailSubjectIsNull();
        }
        if (emailSubject_notNull != null) {
            c.andEmailSubjectIsNotNull();
        }
        if (emailSubject != null) {
            c.andEmailSubjectEqualTo(emailSubject);
        }
        if (emailSubject_not != null) {
            c.andEmailSubjectNotEqualTo(emailSubject_not);
        }
        if (emailSubject_greater != null) {
            c.andEmailSubjectGreaterThan(emailSubject_greater);
        }
        if (emailSubject_greaterEqual != null) {
            c.andEmailSubjectGreaterThanOrEqualTo(emailSubject_greaterEqual);
        }
        if (emailSubject_less != null) {
            c.andEmailSubjectLessThan(emailSubject_less);
        }
        if (emailSubject_lessEqual != null) {
            c.andEmailSubjectLessThanOrEqualTo(emailSubject_lessEqual);
        }
        if (emailSubject_like != null) {
            c.andEmailSubjectLike(emailSubject_like);
        }
        if (emailSubject_notLike != null) {
            c.andEmailSubjectNotLike(emailSubject_notLike);
        }
        if (emailSubject_in != null) {
            c.andEmailSubjectIn(emailSubject_in);
        }
        if (emailSubject_notIn != null) {
            c.andEmailSubjectNotIn(emailSubject_notIn);
        }
        if (emailSubject_between1 != null) {
            c.andEmailSubjectBetween(emailSubject_between1, emailSubject_between2);
        }
        if (emailSubject_notBetween1 != null) {
            c.andEmailSubjectNotBetween(emailSubject_notBetween1, emailSubject_notBetween2);
        }
        Date crtTime_null = TypeCast.getDate(monitorDefineMap.get("crtTime_null"));
        Date crtTime_notNull = TypeCast.getDate(monitorDefineMap.get("crtTime_notNull"));
        Date crtTime = TypeCast.getDate(monitorDefineMap.get("crtTime"));
        Date crtTime_not = TypeCast.getDate(monitorDefineMap.get("crtTime_not"));
        Date crtTime_greater = TypeCast.getDate(monitorDefineMap.get("crtTime_greater"));
        Date crtTime_greaterEqual = TypeCast.getDate(monitorDefineMap.get("crtTime_greaterEqual"));
        Date crtTime_less = TypeCast.getDate(monitorDefineMap.get("crtTime_less"));
        Date crtTime_lessEqual = TypeCast.getDate(monitorDefineMap.get("crtTime_lessEqual"));
        List<Date> crtTime_in = TypeCast.getDateList(monitorDefineMap.get("crtTime_in"));
        List<Date> crtTime_notIn = TypeCast.getDateList(monitorDefineMap.get("crtTime_notIn"));
        Date crtTime_between1 = TypeCast.getDate(monitorDefineMap.get("crtTime_between1"));
        Date crtTime_between2 = TypeCast.getDate(monitorDefineMap.get("crtTime_between2"));
        Date crtTime_notBetween1 = TypeCast.getDate(monitorDefineMap.get("crtTime_notBetween1"));
        Date crtTime_notBetween2 = TypeCast.getDate(monitorDefineMap.get("crtTime_notBetween2"));

        if (crtTime_null != null) {
            c.andCrtTimeIsNull();
        }
        if (crtTime_notNull != null) {
            c.andCrtTimeIsNotNull();
        }
        if (crtTime != null) {
            c.andCrtTimeEqualTo(crtTime);
        }
        if (crtTime_not != null) {
            c.andCrtTimeNotEqualTo(crtTime_not);
        }
        if (crtTime_greater != null) {
            c.andCrtTimeGreaterThan(crtTime_greater);
        }
        if (crtTime_greaterEqual != null) {
            c.andCrtTimeGreaterThanOrEqualTo(crtTime_greaterEqual);
        }
        if (crtTime_less != null) {
            c.andCrtTimeLessThan(crtTime_less);
        }
        if (crtTime_lessEqual != null) {
            c.andCrtTimeLessThanOrEqualTo(crtTime_lessEqual);
        }
        if (crtTime_in != null) {
            c.andCrtTimeIn(crtTime_in);
        }
        if (crtTime_notIn != null) {
            c.andCrtTimeNotIn(crtTime_notIn);
        }
        if (crtTime_between1 != null) {
            c.andCrtTimeBetween(crtTime_between1, crtTime_between2);
        }
        if (crtTime_notBetween1 != null) {
            c.andCrtTimeNotBetween(crtTime_notBetween1, crtTime_notBetween2);
        }
        if (monitorDefineMap.get("orderBy") != null) {
            monitorDefineEx.setOrderByClause((String) monitorDefineMap.get("orderBy"));
        }
        if (limitStart != null && limitOffset != null) {
            monitorDefineEx.setLimitStart(limitStart);
            monitorDefineEx.setLimitOffset(limitOffset);
        }

        return monitorDefineEx;
    }
}
